home *** CD-ROM | disk | FTP | other *** search
- /* getpalette */
- #include <stdio.h>
- #include <graphics.h>
-
- main()
- {
- int graphdriver = DETECT,graphmode,i;
- struct palettetype cur_palette;
- char buffer[80];
-
- /* Initialize the graphics system */
- initgraph(&graphdriver,&graphmode,"c:\\turboc");
- outtextxy(10,20,"Demonstrating getpalette");
- /* Get current palette and print it out */
- getpalette(&cur_palette);
- sprintf(buffer,"Current palette has %d colors",cur_palette.size);
- outtextxy(10,60,buffer);
- outtextxy(10,70,"The entries are: ");
- moveto(10,80);
- for(i=0;i<cur_palette.size;i++);
- {
- sprintf(buffer,"%2d ",cur_palette.colors[i]);
- outtext(buffer);
- }
- outtextxy(10,270,"Hit any key to exit:");
- closegraph();
- }